<? include("/inc/header.html") {} ?>
<style>
.row{
	margin-bottom: 10px;
}
</style>
<div class="col-lg-12" style="overflow: auto;height: 500px;">
	<div class="panel panel">
		<div class="panel-body pan">
			<div class="form-body pal">
				<div class="row">
					<label for="inputUsername" class="col-md-3 control-label">题库名称<span
						class='require'>*</span> </label>
					<div class="col-md-9">
							<div class="input-icon">
								<input id="name" type="text" class="form-control" />
							</div>
					</div>
				</div>
				<div class="row">
					<label for="inputUsername" class="col-md-3 control-label">学科类型
						<span class='require'>*</span> </label>
					<div class="col-md-9">
						<div class="input-icon">
							<select class="form-control" id="type">
									<option value="">全部</option>
									<option value="语文">语文</option>
									<option value="数学">数学</option>
									<option value="英语">英语</option>
								</select>
						</div>
					</div>
				</div>
				<div class="row">
					<label for="inputUsername" class="col-md-3 control-label">题库标签
						<span class='require'>*</span> </label>
					<div class="col-md-9">
						<div class="input-icon">
							<input id="tag" type="text" class="form-control" />
						</div>
					</div>
				</div>
				<div class="row">
					<label for="inputUsername" class="col-md-3 control-label">题库描述
						<span class='require'>*</span> </label>
					<div class="col-md-9">
						<div class="input-icon">
							<textarea style="width: 100%;" rows="5" id="description"></textarea>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<input type="hidden" id="id" value="${id}">
</div>
<script>
	
	$(function() {
		init1();
		init();
	});
	function init1(){
		$.ajax({
				type : "post",
				url : "./configByName.do",
				data : {
					"nameEn" : "学科类型"
				},
				dataType : "json",
				success : function(data) {
					var html='<option value="">全部</option>';
					var values = data.nameVlue.split(";");
					
					for(var i=0;i<values.length;i++){
						html+='<option value="'+values[i].nameEn+'">'+values[i].nameEn+'</option>';
					}
					$("#type").val(html);
				},
				error : function(data) {
					alert("请求失败");
				}
			});
	}
function init(){
	if($("#id").val() != null 
		&& $("#id").val() != ''
		&& $("#id").val() != 'null'
		&& $("#id").val() != 'undefined'
		&&$("#id").val() != undefined){
		$.ajax({
			type : "post",
			url : "./questionDatabaseFind.do",
			data : {
				"id" : $("#id").val(),	
			},
			dataType : "json",
			success : function(data) {
				$("#name").val(data[0].name);
				$("#tag").val(data[0].tag);
				$("#type").val(data[0].type);
				$("#description").val(data[0].description);
			},
			error : function(data) {
				alert("请求失败");
			}
		});
	}
}
</script>